package lab02.Test17;

public class Test17 {
    public static void main(String[] args) {
        int[] shu = {30, 80, 56, 64, 25, 36,25,63,89,10};
        int max=0; int n=0;
        for (int i=0;i<shu.length;i++){
            if(shu[i]>max){
                max=shu[i];
                n=i+1;
            }
        }
        System.out.println("最大值："+max);
        System.out.println("最大值为第几个："+n);
        int min=30; int m=0;
        for (int i=0;i<shu.length;i++){
            if (shu[i]<min){
                min=shu[i];
                m=i+1;
            }
        }
        System.out.println("最小值："+min);
        System.out.println("最小值是第几个："+m);


        int sum=0;
        for (int i=0;i<(shu.length);){
            sum+=shu[i++];
        }
        System.out.println("总和为："+sum);
        for (int i=0;i<(shu.length-1);i++){
            for (int j=0;j<(shu.length-1-i);j++){
                if (shu[j]>shu[j+1]){
                    int huan=shu[j];
                    shu[j]=shu[j+1];
                    shu[j+1]=huan;
                }
            }
        }
        for (int l:shu){
            System.out.println("排序为:"+l);
        }
    }
}


